package com.jackiechancinema.ssm.controller;

import com.jackiechancinema.ssm.bo.PerfBo;
import com.jackiechancinema.ssm.entity.FileHome;
import com.jackiechancinema.ssm.service.Inte.FileHomeService;
import com.jackiechancinema.ssm.vo.PageVo;
import com.jackiechancinema.ssm.vo.R;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;
import org.springframework.web.multipart.MultipartFile;

import javax.servlet.http.HttpServletResponse;
import java.io.File;
import java.util.ArrayList;
import java.util.List;

@RestController //等价于 @Controller+@ResponseBody
@RequestMapping("/page/student/")
public  class FiemHomeController {
    @Autowired
    private FileHomeService homeService;
    @RequestMapping("look")
    public PageVo<FileHome> queryAll(int page,int limit){
        return homeService.queryAll(page,limit);
    }
    @RequestMapping("save")
    public R save(FileHome fileHome){
        System.out.println(fileHome);
        return homeService.save(fileHome);
    }
   @RequestMapping("delete")
    public R deleteById(int hall_id){
       R r = homeService.deleteById(hall_id);
       return r;
   }
   @RequestMapping("update")
    public R updateById(FileHome fileHome){
        return homeService.updateById(fileHome);
   }
   @RequestMapping("batchaddfilm")
   public R batch(MultipartFile file){
       System.out.println(file.getSize());
       return homeService.batchAdd(file);
   }
   @RequestMapping("downfilehome")
   public void downPerf(HttpServletResponse response){
       System.out.println(1);
       homeService.exportExcel(response);
   }
}
